package vq.codec.ui;

import java.util.List;

import javax.swing.JOptionPane;

import vq.codec.entities.Dat;
import vq.codec.entities.Dictionary;
import vq.codec.entities.EncodeMethod;
import vq.codec.exception.EncodingException;
import vq.codec.exception.SystemException;
import vq.codec.managers.VQCodecManager;
import vq.codec.managers.VQFileManager;
import vq.codec.profiling.Profiler;

/**
 * Classe criada para representar o frame principal de entrada de dados para a codificação e
 * o resultado da mesma.
 *
 * @author Gutemberg Rodrigues
 * @since Outubro de 2009
 * @version 0.2
 */

public class InputScreen extends javax.swing.JFrame {

	private VQFileManager fileManager;
	private VQCodecManager codedManager;
	
    public InputScreen() {
        initComponents();
        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        fileManager = VQFileManager.getInstance();
        codedManager = VQCodecManager.getInstance();
    }

    @SuppressWarnings("unchecked")
    
    private void initComponents() {

        labelDictionary = new javax.swing.JLabel();
        labelSource = new javax.swing.JLabel();
        txtDictionary = new javax.swing.JTextField();
        txtSource = new javax.swing.JTextField();
        labelInformation = new javax.swing.JLabel();
        buttonCodec = new javax.swing.JButton();
        buttonClean = new javax.swing.JButton();
        labelDestination = new javax.swing.JLabel();
        txtDestination = new javax.swing.JTextField();
        labelInformation2 = new javax.swing.JLabel();
        labelInformation3 = new javax.swing.JLabel();
        panelResult = new javax.swing.JPanel();
        labelOp = new javax.swing.JLabel();
        labelTime = new javax.swing.JLabel();
        txtTime = new javax.swing.JTextField();
        labelResult = new javax.swing.JLabel();
        labelOpSoma = new javax.swing.JLabel();
        labelOpSub = new javax.swing.JLabel();
        labelOpMult = new javax.swing.JLabel();
        labelOpDiv = new javax.swing.JLabel();
        labelOpComp = new javax.swing.JLabel();
        labelOpPot = new javax.swing.JLabel();
        txtOpSoma = new javax.swing.JTextField();
        txtOpSub = new javax.swing.JTextField();
        txtOpMult = new javax.swing.JTextField();
        txtOpDiv = new javax.swing.JTextField();
        txtOpComp = new javax.swing.JTextField();
        txtOpPot = new javax.swing.JTextField();
        comboCodec = new javax.swing.JComboBox();
        labelTypeCodec = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        labelDictionary.setText("Informe o caminho do arquivo do dicionário:");

        labelSource.setText("Informe o caminho do arquivo a ser codificado:");

        txtDictionary.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtDictionaryActionPerformed(evt);
            }
        });

        txtSource.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtSourceActionPerformed(evt);
            }
        });

        labelInformation.setForeground(new java.awt.Color(153, 153, 153));
        labelInformation.setText("exemplo:  C:\\Users\\Administrador\\Desktop\\dicionarios\\nomedicionario.dic");

        buttonCodec.setFont(new java.awt.Font("Tahoma", 1, 11));
        buttonCodec.setIcon(new javax.swing.ImageIcon("./images/iconeConfirmar.gif")); 
        buttonCodec.setText("Codificar");
        buttonCodec.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCodecActionPerformed(evt);
            }
        });

        buttonClean.setFont(new java.awt.Font("Tahoma", 1, 11));
        buttonClean.setIcon(new javax.swing.ImageIcon("./images/imagemLimpar.jpg"));
        buttonClean.setText("Limpar Campos");
        buttonClean.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonCleanActionPerformed(evt);
            }
        });

        labelDestination.setText("Informe a pasta de destino do arquivo:");

        txtDestination.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtDestinationActionPerformed(evt);
            }
        });

        labelInformation2.setForeground(new java.awt.Color(153, 153, 153));
        labelInformation2.setText("exemplo: C:\\Users\\Administrador\\Desktop\\sinais\\airplane.pgm");

        labelInformation3.setForeground(new java.awt.Color(153, 153, 153));
        labelInformation3.setText("exemplo: C:\\Users\\Administrador\\Desktop\\nomeArquivo");

        panelResult.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 204, 204), 1, true));

        labelOp.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelOp.setText("Quantidade de Operações:");

        labelTime.setFont(new java.awt.Font("Tahoma", 1, 11)); 
        labelTime.setText("Tempo de Execução (ms):");

        txtTime.setEditable(false);
        txtTime.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtTimeActionPerformed(evt);
            }
        });

        labelResult.setFont(new java.awt.Font("Tahoma", 3, 12));
        labelResult.setForeground(new java.awt.Color(51, 51, 51));
        labelResult.setText("Resultados ");

        labelOpSoma.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelOpSoma.setText("Soma:");

        labelOpSub.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelOpSub.setText("Subtração:");

        labelOpMult.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelOpMult.setText("Multiplicação:");

        labelOpDiv.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelOpDiv.setText("Divisão:");

        labelOpComp.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelOpComp.setText("Comparação:");

        labelOpPot.setFont(new java.awt.Font("Tahoma", 1, 11));
        labelOpPot.setText("Potênciação:");

        txtOpSoma.setEditable(false);
        txtOpSoma.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtOpSomaActionPerformed(evt);
            }
        });

        txtOpSub.setEditable(false);
        txtOpSub.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtOpSubActionPerformed(evt);
            }
        });

        txtOpMult.setEditable(false);
        txtOpMult.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtOpMultActionPerformed(evt);
            }
        });

        txtOpDiv.setEditable(false);
        txtOpDiv.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtOpDivActionPerformed(evt);
            }
        });

        txtOpComp.setEditable(false);
        txtOpComp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtOpCompActionPerformed(evt);
            }
        });

        txtOpPot.setEditable(false);
        txtOpPot.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtOpPotActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelResultLayout = new javax.swing.GroupLayout(panelResult);
        panelResult.setLayout(panelResultLayout);
        panelResultLayout.setHorizontalGroup(
            panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelResultLayout.createSequentialGroup()
                .addGap(108, 108, 108)
                .addComponent(labelTime)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtTime, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
                .addGap(30, 30, 30)
                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelResultLayout.createSequentialGroup()
                        .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelResultLayout.createSequentialGroup()
                                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(labelOpSoma)
                                    .addComponent(labelOpSub))
                                .addGap(26, 26, 26)
                                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtOpSoma, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                                    .addComponent(txtOpSub, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)))
                            .addGroup(panelResultLayout.createSequentialGroup()
                                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(labelOpDiv)
                                    .addComponent(labelOpComp)
                                    .addComponent(labelOpPot)
                                    .addComponent(labelOpMult))
                                .addGap(10, 10, 10)
                                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtOpMult, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                                    .addComponent(txtOpPot, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                                    .addComponent(txtOpComp, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                                    .addComponent(txtOpDiv, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE))))
                        .addGap(163, 163, 163))
                    .addGroup(panelResultLayout.createSequentialGroup()
                        .addComponent(labelOp)
                        .addContainerGap())))
            .addGroup(panelResultLayout.createSequentialGroup()
                .addGap(305, 305, 305)
                .addComponent(labelResult)
                .addContainerGap(334, Short.MAX_VALUE))
        );
        panelResultLayout.setVerticalGroup(
            panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelResultLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(labelResult)
                .addGap(18, 18, 18)
                .addComponent(labelOp)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelOpSoma)
                    .addComponent(txtOpSoma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelTime)
                    .addComponent(txtTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelOpSub)
                    .addComponent(txtOpSub, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelOpMult)
                    .addComponent(txtOpMult, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelOpDiv)
                    .addComponent(txtOpDiv, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelOpComp)
                    .addComponent(txtOpComp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelResultLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelOpPot)
                    .addComponent(txtOpPot, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(18, Short.MAX_VALUE))
        );

        comboCodec.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "FS", "PDS" }));

        labelTypeCodec.setText("Informe o tipo de codificação:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(labelDictionary)
                        .addGap(440, 440, 440))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(labelInformation)
                        .addContainerGap(372, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(labelSource)
                        .addContainerGap(498, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(labelInformation3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(labelInformation2)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(labelDestination, javax.swing.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE)
                                .addGap(391, 391, 391)))
                        .addContainerGap())
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(comboCodec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(679, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(txtDictionary, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 713, Short.MAX_VALUE)
                            .addComponent(txtDestination, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 713, Short.MAX_VALUE)
                            .addComponent(txtSource, javax.swing.GroupLayout.DEFAULT_SIZE, 713, Short.MAX_VALUE))
                        .addContainerGap())
                    .addComponent(labelTypeCodec)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(panelResult, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(buttonClean)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 416, Short.MAX_VALUE)
                                .addComponent(buttonCodec, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelDictionary)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtDictionary, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelInformation)
                .addGap(18, 18, 18)
                .addComponent(labelSource)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtSource, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelInformation2)
                .addGap(18, 18, 18)
                .addComponent(labelDestination)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(txtDestination, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelInformation3)
                .addGap(18, 18, 18)
                .addComponent(labelTypeCodec)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(comboCodec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(33, 33, 33)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonCodec, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonClean, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(panelResult, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }

    private void txtDictionaryActionPerformed(java.awt.event.ActionEvent evt) {
    }

    private void txtSourceActionPerformed(java.awt.event.ActionEvent evt) {
    }

    private void buttonCodecActionPerformed(java.awt.event.ActionEvent evt) {
    	checkClean();
        if(comboCodec.getSelectedItem().toString().equals("FS")){
            functionFS();
        }else{
        	functionPDS();
        }
    }
    
    private void functionFS(){
    	labelResult.setText("Resultados FS ");
    	List<Integer> encoded = null;
    	Profiler profile = new Profiler();
    	Dictionary dictionary = null;
    	Dat source = null;
    	
    	try{
    		dictionary = fileManager.loadDictionaryFile(txtDictionary.getText());
    		source = fileManager.loadSourceFile(dictionary.getQuantizatorDimension(), txtSource.getText());
    	
    		encoded = codedManager.encode(source, dictionary, EncodeMethod.FULL_SCAN, profile);
    	
    		fileManager.generateEncodedFile(encoded, txtDestination.getText());
    		fileManager.generateDatFile(source, txtDestination.getText());
    	
    		JOptionPane.showMessageDialog(this, "Processo Finalizado!", "Fim", JOptionPane.INFORMATION_MESSAGE);
    		
    	}catch (EncodingException e){
			JOptionPane.showMessageDialog(this, "Erro de codificação!", "Erro", JOptionPane.ERROR_MESSAGE);
		}catch(SystemException e){
    		JOptionPane.showMessageDialog(this, e.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
    	}
    	
    	//Seta na tela o tempo de execução
    	txtTime.setText(String.valueOf(profile.getExecutionTime()));
    	//Seta as operações
    	txtOpSoma.setText(String.valueOf(profile.getSumOperationQuantity()));
		txtOpSub.setText(String.valueOf(profile.getSubtractOperationQuantity()));
		txtOpMult.setText(String.valueOf(profile.getMultiplicationOperationQuantity()));
		txtOpDiv.setText(String.valueOf(profile.getDivisionOperationQuantity()));
		txtOpComp.setText(String.valueOf(profile.getComparisonOperationQuantity()));
		txtOpPot.setText(String.valueOf(profile.getPotentiationOperationQuantity()));
    }
    
    private void functionPDS(){
    	labelResult.setText("Resultados PDS ");
    	List<Integer> encoded = null;
    	Profiler profile = new Profiler();
    	Dictionary dictionary = null; 
    	Dat source = null; 
    	
    	try{
    		dictionary = fileManager.loadDictionaryFile(txtDictionary.getText());
    		source = fileManager.loadSourceFile(dictionary.getQuantizatorDimension(), txtSource.getText());
    	
    		encoded = codedManager.encode(source, dictionary, EncodeMethod.PARTIAL_DISTANCE_SEARCH, profile);
    	
    		fileManager.generateEncodedFile(encoded, txtDestination.getText());
    	
    		JOptionPane.showMessageDialog(this, "Processo Finalizado!", "Fim", JOptionPane.INFORMATION_MESSAGE);
    		
    	}catch (EncodingException e){
			JOptionPane.showMessageDialog(this, "Erro de codificação!", "Erro", JOptionPane.ERROR_MESSAGE);
		}catch(SystemException e){
    		JOptionPane.showMessageDialog(this, e.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
    	}
    	
    	//Seta na tela o tempo de execução
    	txtTime.setText(String.valueOf(profile.getExecutionTime()));
    	//Seta as operações
    	txtOpSoma.setText(String.valueOf(profile.getSumOperationQuantity()));
		txtOpSub.setText(String.valueOf(profile.getSubtractOperationQuantity()));
		txtOpMult.setText(String.valueOf(profile.getMultiplicationOperationQuantity()));
		txtOpDiv.setText(String.valueOf(profile.getDivisionOperationQuantity()));
		txtOpComp.setText(String.valueOf(profile.getComparisonOperationQuantity()));
		txtOpPot.setText(String.valueOf(profile.getPotentiationOperationQuantity()));
    }
    
    private void checkClean(){
    	if(txtDictionary.getText().length() == 0 || txtSource.getText().length() == 0 || txtDestination.getText().length() == 0){
            JOptionPane.showMessageDialog(this, "Campo não informado",
                    "Atenção", JOptionPane.ERROR_MESSAGE);
            throw new SystemException("Campo da Tela em Branco!", null);
        }
    }

    private void buttonCleanActionPerformed(java.awt.event.ActionEvent evt) {
        txtDictionary.setText("");
        txtSource.setText("");
        txtDestination.setText("");
        txtDictionary.requestFocus();
    }

    private void txtDestinationActionPerformed(java.awt.event.ActionEvent evt) {
    }

    private void txtTimeActionPerformed(java.awt.event.ActionEvent evt) {
    }

    private void txtOpSomaActionPerformed(java.awt.event.ActionEvent evt) {
    }

    private void txtOpSubActionPerformed(java.awt.event.ActionEvent evt) {
    }

    private void txtOpMultActionPerformed(java.awt.event.ActionEvent evt) {
    }

    private void txtOpDivActionPerformed(java.awt.event.ActionEvent evt) {
    }

    private void txtOpCompActionPerformed(java.awt.event.ActionEvent evt) {
    }

    private void txtOpPotActionPerformed(java.awt.event.ActionEvent evt) {
    }

    public void openFrameInputScreen(){
         InputScreen frameInputScreen = new InputScreen();
         frameInputScreen.setVisible(true);
         frameInputScreen.setLocationRelativeTo(null);
    }

    private javax.swing.JButton buttonClean;
    private javax.swing.JButton buttonCodec;
    private javax.swing.JComboBox comboCodec;
    private javax.swing.JLabel labelDestination;
    private javax.swing.JLabel labelDictionary;
    private javax.swing.JLabel labelInformation;
    private javax.swing.JLabel labelInformation2;
    private javax.swing.JLabel labelInformation3;
    private javax.swing.JLabel labelOp;
    private javax.swing.JLabel labelOpComp;
    private javax.swing.JLabel labelOpDiv;
    private javax.swing.JLabel labelOpMult;
    private javax.swing.JLabel labelOpPot;
    private javax.swing.JLabel labelOpSoma;
    private javax.swing.JLabel labelOpSub;
    private javax.swing.JLabel labelResult;
    private javax.swing.JLabel labelSource;
    private javax.swing.JLabel labelTime;
    private javax.swing.JLabel labelTypeCodec;
    private javax.swing.JPanel panelResult;
    private javax.swing.JTextField txtDestination;
    private javax.swing.JTextField txtDictionary;
    private javax.swing.JTextField txtOpComp;
    private javax.swing.JTextField txtOpDiv;
    private javax.swing.JTextField txtOpMult;
    private javax.swing.JTextField txtOpPot;
    private javax.swing.JTextField txtOpSoma;
    private javax.swing.JTextField txtOpSub;
    private javax.swing.JTextField txtSource;
    private javax.swing.JTextField txtTime;

}
